/*
 *  Copyright 2008-2011 NVIDIA Corporation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

#pragma once

#include <thrust/detail/config.h>
#include <thrust/detail/type_traits.h>
#include <thrust/detail/type_traits/has_nested_type.h>

namespace thrust
{
namespace detail
{

template<typename Alloc>
  struct allocator_value
{
  typedef typename Alloc::value_type type;
};

template<typename Alloc>
  struct allocator_pointer
{
  typedef typename Alloc::pointer type;
};

template<typename Alloc>
  struct allocator_const_pointer
{
  typedef typename Alloc::const_pointer type;
};

template<typename Alloc>
  struct allocator_difference
{
  typedef typename Alloc::difference_type type;
};

template<typename Alloc>
  struct allocator_size
{
  typedef typename Alloc::size_type type;
};

template<typename Alloc>
  struct allocator_traits
{
  typedef Alloc                                           allocator_type;
  typedef typename allocator_value<Alloc>::type           value_type;

  typedef typename allocator_pointer<Alloc>::type         pointer;
  typedef typename allocator_const_pointer<Alloc>::type   const_pointer;
  typedef typename allocator_difference<Alloc>::type      difference_type;
  typedef typename allocator_size<Alloc>::type            size_type;
};
  
} // end detail
} // end thrust

